package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectTaskMemberApi;
import com.nbsaas.boot.project.api.domain.request.ProjectTaskMemberRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectTaskMemberResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectTaskMemberSimple;
import com.nbsaas.boot.project.data.entity.ProjectTaskMember;
import com.nbsaas.boot.project.data.repository.ProjectTaskMemberRepository;
import com.nbsaas.boot.project.rest.convert.ProjectTaskMemberEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTaskMemberResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTaskMemberSimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   任务参与人-业务接口实现
 */
@Transactional
@Service
public class ProjectTaskMemberResource extends BaseResource<ProjectTaskMember, ProjectTaskMemberResponse, ProjectTaskMemberSimple, ProjectTaskMemberRequest> implements ProjectTaskMemberApi {

    @Resource
    private ProjectTaskMemberRepository projectTaskMemberRepository;

    @Override
    public JpaRepositoryImplementation<ProjectTaskMember, Serializable> getJpaRepository() {
        return projectTaskMemberRepository;
    }

    @Override
    public Function<ProjectTaskMember, ProjectTaskMemberSimple> getConvertSimple() {
        return new ProjectTaskMemberSimpleConvert();
    }

    @Override
    public Function<ProjectTaskMemberRequest, ProjectTaskMember> getConvertForm() {
        return new ProjectTaskMemberEntityConvert();
    }

    @Override
    public Function<ProjectTaskMember, ProjectTaskMemberResponse> getConvertResponse() {
        return new ProjectTaskMemberResponseConvert();
    }


}


